package com.cat.singleton.demo01;

/**
 * @author cat
 * @version 2025/5/15 16:41
 * @description 懒汉式(synchronized)
 * @since JDK17
 */

public class Singleton02 {
    private Singleton02() {
    }

    private static Singleton02 instance;

    public static synchronized Singleton02 getInstance() {
        if (instance == null) {
            instance = new Singleton02();
        }
        return instance;
    }
}
